<template>
    <BasisTable :columns="table_config.table_header" :config="table_config.config" :request="table_config.request">
        <template v-slot:operation="slotData">
            <el-tooltip content="编辑" placement="bottom" effect="light">
                <el-button type="primary" icon="Edit" circle 
                @click="handlerDetailed(slotData.data.userid,slotData.data.projectid)" />
            </el-tooltip>
        </template>


    </BasisTable>
</template>

<script>
import { reactive, provide } from 'vue';
import { useRouter } from "vue-router";

import BasisTable from '../../components/table/BasisTable.vue';
export default {
    name: "ProjectList",
    components: { BasisTable },
    setup(props) {
        const search_config = reactive({
            // label_width: "100px",
            // form_button_group: [
            //     { label: "新增", type: "primary", callback: () => addInfo() },
            // ],
        })
        provide("search_config", search_config);

        // router
        const { push } = useRouter();
        const table_config = reactive({
            table_header: [
                { label: "项目编号", prop: "projectid" },
                { label: "项目名称", prop: "name" },
                { label: "项目版本", prop: "version" },
                { label: "分析状态", prop: "status" },
                { label: "上次修改时间", prop: "lastupdate" },
                { label: "操作", type: "slot", slot_name: "operation", delete_elem: true, },
            ],
            config: {},
            request: {
                url: "info",
                data: {
                    //pageNumber: 1,
                    //pageSize: 10,
                    userid:10,
                },
                delete_key: "projectid"
            }
        })

        //编辑页
        const handlerDetailed = (userid,projectid) => {
            push({
                path: "/home/projectEdit",
                query: { userid,projectid }
            })
        }
        const addInfo = () => {
            push({
                path: "/home/projectAdd"
            })
        }
        return {
            table_config,
            handlerDetailed,
            addInfo,
        }
    }

}
</script>

<style scoped></style>